# _*_ utf-8 _*_
__author__ = "LiuJian"
__date__ = "2021/8/17 0017 9:46"
# @FileName :Manager.py

from flask import Flask,render_template,request
import pymysql

app = Flask(__name__)

@app.route('/Melon')
def index():
    return render_template('login.html')

@app.route('/Melon/commit', methods={'get'})
def commit():
    conn = pymysql.connect(user='user',
                         password="leboAa!#$123",
                         host='49.233.39.160',
                         port=3306,
                         database='lebo',
                         charset='utf8'
    )
    cur = conn.cursor(cursor=pymysql.cursors.DictCursor)
    uname = request.args['username']
    uheight = float(request.args.get('pwd'))
    sql = "select * from melon where uname = '%s' and uheight = %f;" % (uname, uheight)
    ret = cur.execute(sql)
    select_01 = str(cur.fetchone())
    cur.close()
    print('查询的用户数为%d' % ret)
    return '查询的用户为%s' % select_01


if __name__ == "__main__":

    app.debug = True
    app.run(host='0.0.0.0')